package cn.edu.lingnan.tourism.mapper;

import cn.edu.lingnan.tourism.pojo.Route;
import cn.edu.lingnan.tourism.pojo.Seller;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface SellerMapper extends Mapper<Seller> {

    //根据名字进行模糊查询
    @Select("select * from tab_seller where sname like CONCAT('%',#{str},'%')")
    public List<Seller> selectSellerByString(String str);
    //获取商家信息
    @Select("SELECT * FROM tab_seller WHERE sid = #{sid}")
    Seller getSellerDetails(Integer sid);
    //根据商家的id查询相对应的的路线
    @Select("SELECT * FROM tab_route,tab_seller WHERE tab_route.sid = #{sid} and tab_seller.sid = #{sid}")
    List<Route> getRoutesBySellerId(Integer sid);
    //查询商家总数
    @Select("SELECT count(sid) from tab_seller")
    public Integer selectSellerCount();
}
